package gov.pbc.gx.nn.pz.impl;

import gov.pbc.gx.nn.pz.dao.AccountDao;
import gov.pbc.gx.nn.pz.dao.QueryAccountDao;
import gov.pbc.gx.nn.pz.entity.Account;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.bstek.dorado.annotation.DataProvider;
import com.bstek.dorado.annotation.DataResolver;
import com.bstek.dorado.annotation.Expose;
import com.bstek.dorado.data.provider.Criteria;
import com.bstek.dorado.data.provider.Page;

@Component("pz.accountPR")
public class AccountPR {

	@Autowired
	private QueryAccountDao qad;

	@Autowired
	private AccountDao ad;

	@DataProvider
	public void getAll(Page<Account> page, Criteria criteria) throws Exception {
		this.qad.getAll(page, criteria);
	}

	@Transactional
	@DataResolver
	public void save(List<Account> list) {
		this.ad.save(list);
	}

	@Expose
	@Transactional
	public void delete(String id) {
		this.ad.delete(id);
	}

	@Expose
	public void checkUnique(String id, String account) {
		this.ad.checkUnique(id, account);
	}
}
